package org.test.service.combine.impl;

import org.easyspring.core.annotation.Autowired;
import org.easyspring.core.annotation.Service;
import org.test.entity.bo.HeadLine;
import org.test.entity.bo.ShopCategory;
import org.test.entity.dto.MainPageInfoDto;
import org.test.entity.dto.Result;
import org.test.service.combine.HeadAndCategoryCombineService;
import org.test.service.solo.HeadLineService;
import org.test.service.solo.ShopCategoryService;

import java.util.List;

/**
 * Created by Hy on 2021/7/24.
 */
@Service
public class HeadAndCategoryCombineServiceImpl implements HeadAndCategoryCombineService {
    @Autowired
    private HeadLineService headLineService;
    @Autowired
    private ShopCategoryService shopCategoryService;
    @Override
    public Result<MainPageInfoDto> getMainPageInfo() {
        //1.获取头条列表
        HeadLine headLine = new HeadLine();
        headLine.setStatus(1);
        Result<List<HeadLine>> headLines = headLineService.queryHeadLines(headLine, 1, 10);
        //2.获取店铺类别列表
        ShopCategory shopCategory = new ShopCategory();
        shopCategory.setParent(null);
        Result<List<ShopCategory>> shopCategorys = shopCategoryService.queryShopCategorys(shopCategory, 1, 100);
        //3.合并两者并返回
        return mergeMainPageInfo(headLines,shopCategorys);
    }

    private Result<MainPageInfoDto> mergeMainPageInfo(Result<List<HeadLine>> headLines, Result<List<ShopCategory>> shopCategorys) {
        return null;
    }
}
